<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="spring" 	uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="tiles" 	uri="http://tiles.apache.org/tags-tiles" %>
<%@ taglib prefix="c"		uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page language="java" pageEncoding="utf-8"%>

<script type="text/javascript">
$(document).ready(function(){
	setMenuSelection("clienti");
	
    $("#btCompaniesList").kendoButton({icon: "funnel"});

    $("#btCompaniesCard").kendoButton({icon: "plus"});
	
    $("#btApplyFilter").kendoButton({icon: "tick"});

    $("#btResetFilter").kendoButton({icon: "cancel"});
    
    
    $("#gridCompaniesList").kendoGrid({
    	dataSource : {
            type     : "json",
            transport: {
                read: "json/listRegCompanies"
            },
            schema   : {
                data: ""
            }
        },
        columns: [
				{
					field:"id",  							
					title: "#",
					width: 40,
					hidden: true
				},
          		{	
					field:"idno",  						
					title: "Cod fiscal",
					sortable: true,
					width: 100 , 
					template: renderIdnp
				},
                {field: "companyName", 					title: "Denumire firmă", 					width: 100},
                {field: "refActivityType", 				title: "Genul de activitate", 				width: 120, template: renderActivityType},
                {field: "phoneMob", 					title: "Telefon mobil", 				width: 90},
                {field: "emal", 						title: "E-mail", 				width: 120},
                {field: "skype", 						title: "Skype", 				width: 120},
                {field: "bossNameSurname", 				title: "Director", 				width: 120}
          ],
          height: 500,
          sortable: true,
          pageable: {
        	  pageSize: 15,
        	  pageSizes: [15,30,50],
        	  refresh: true
          }

    });    
 
function  renderIdnp (dataItem, b, c) {
	return "<a href='adaugaClientCompanie?pId="+dataItem.id + "'>" + kendo.htmlEncode(dataItem.idno) + "</a>"; 
	}    
    
function  renderActivityType(dataItem) {
	var result  = "";
	if (dataItem.refActivityType) {
		result = dataItem.refActivityType.mdValue;
	}
	return result; 
};     

});

function btApplyClick(){
	$("#gridCompaniesList").data("kendoGrid").dataSource.read();
	$("#gridCompaniesList").data("kendoGrid").refresh();
}

function btResetClick(){
	
}
		
</script>
<CENTER>
<p style="text-align: left;">
	<button id="btCompaniesList" type="button" onclick="javascript:window.open('vizualizeazaClientiCompanie', target='_self')";>Lista persoanelor juridice</button>
	<button id="btCompaniesCard" type="button" onclick="javascript:window.open('adaugaClientCompanie', 		target='_self')";>Adaugă persoană juridică</button>
	<c:if test="${errorMessage != '' &&  errorMessage != '0'}">
		<span id="errorMessage" class="errorMessage"> ${errorMessage} </span>
	</c:if>
	
</p>
<!-- <div id="tabPersonsListFilters" style="text-align: left; font-size: 12px;" class="k-block k-shadow" ><div class="k-header">Parametrii de cautare</div> -->
<!-- 	<table style="width: 100%; border: 1px;" border="0" > -->
<!-- 			<tr> -->
<!-- 				<td style="width: 100px;">Cod fiscal</td> -->
<!-- 				<td style="width: 200px;">Denumire firmă</td> -->
<!-- 				<td style="width: 200px;">Nume, Prenume director</td> -->
<!-- 				<td>						Genul de activitate</td> -->
<!-- 			</tr> -->
<!-- 			<tr> -->
<!-- 				<td><input id='fIdno' 				name='fIdno' 			type='text' value='' class="k-textbox" style="width: 100px;"></td> -->
<!-- 				<td><input id='fCompanyName' 		name='fCompanyName' 	type='text' value='' class="k-textbox" style="width: 200px;"></td> -->
<!-- 				<td><input id='fBossNameSurname' 	name='fBossNameSurname' type='text' value='' class="k-textbox" style="width: 200px;"></td> -->
<!-- 				<td><input id='fRefActivityType' 	name='fRefActivityType'	type='text' value='' class="k-textbox" style="width: 300px;"></td> -->
<!-- 			</tr> -->
<!-- 		</table> -->
<!-- 		<p style="text-align: right;"> -->
<!-- 				<button id="btApplyFilter" type="button"	onclick="btApplyClick()" >Aplica</button> -->
<!-- 				<button id="btResetFilter" type="button" 	onclick="btResetClick()" >Curata</button>			 -->
<!-- 		</p>		 -->
<!-- </div> -->
<div id="gridCompaniesList"></div>

</center>




